@extends('layouts.mobile')

@section('title', '意见反馈')

@section('content')
    <style type="text/css">
        .feedback{
            display: block;
            padding: 20px 10px;
            background-color: #fff;
        }

        .feedback .form-wrap .form-group .label{
            width: 40px;
            min-width: 40px;
            max-width: 40px;
        }

        .feedback .form-wrap .form-group .textarea{
            height: 160px;
        }
    </style>
    <div class="feedback">
        <div class="form-wrap">
            <form method="post" id="Form">
                {{csrf_field()}}
                <input type="hidden" name="formsubmit" value="yes">
                <div class="form-group">
                    <input type="text" class="form-control" name="title" id="title" placeholder="你要反馈的主题">
                </div>
                <div class="form-group">
                    <textarea class="form-control" style="height: 200px;" name="message" id="message" placeholder="简单描述一下你要反应的问题"></textarea>
                </div>
                <div class="form-group">
                    <button type="button" class="btn btn-primary btn-lg" style="width: 100%;" id="submit">提交</button>
                </div>
            </form>
        </div>
    </div>
    <script type="text/javascript">
        (function () {
            $("#submit").on('click', function () {
                var title = $.trim($("#title").val());
                if (!title) {
                    DSXUI.showToast('请填写主题');
                    return false;
                }

                var message = $.trim($("#message").val());
                if (message.length < 10) {
                    DSXUI.showToast('请简单描述一下你的问题，不少于10个字');
                    return false;
                }

                $("#Form").ajaxSubmit({
                    dataType:'json',
                    beforeSend:DSXUI.showSpinner,
                    success:function (response) {
                        setTimeout(function () {
                            DSXUI.hideSpinner();
                            DSXUI.showToast('你的问题已提交', 1500, function () {
                                window.location.href = '{{url('/mobile/member')}}';
                            });
                        }, 500);
                    }
                });
            })
        })();
    </script>
@stop
